﻿using System;
using System.Collections.Generic;
using System.Windows.Data;
using System.Globalization;
using Asistente.Model.Representation;

namespace Asistente.Converters
{
    class GetTypeFromObjectConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                String t=value.GetType().ToString();
                Int32 punto = t.ToString().LastIndexOf(".");
                Int32 largo = t.Length-1;
                String type = t.Substring(punto+1, largo-punto);
             
                return type;
                //return value.
            }
            return "";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
